.class public Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;
.super Landroid/preference/EditTextPreference;
.source "CustomEditTextPreference.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;
    }
.end annotation


# instance fields
.field private a:Lcom/jecelyin/common/widget/dialog/a;

.field private b:Landroid/widget/EditText;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    .line 1
    invoke-direct {p0, p1}, Landroid/preference/EditTextPreference;-><init>(Landroid/content/Context;)V

    const/4 v0, 0x0

    .line 2
    invoke-direct {p0, p1, v0}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0

    .line 3
    invoke-direct {p0, p1, p2}, Landroid/preference/EditTextPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 4
    invoke-direct {p0, p1, p2}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0
    .annotation build Landroid/annotation/TargetApi;
        value = 0x15
    .end annotation

    .line 5
    invoke-direct {p0, p1, p2, p3}, Landroid/preference/EditTextPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 6
    invoke-direct {p0, p1, p2}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;II)V
    .locals 0
    .annotation build Landroid/annotation/TargetApi;
        value = 0x15
    .end annotation

    .line 7
    invoke-direct {p0, p1, p2, p3, p4}, Landroid/preference/EditTextPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;II)V

    .line 8
    invoke-direct {p0, p1, p2}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

.method private a(Landroid/app/Dialog;)V
    .locals 1

    .line 13
    invoke-virtual {p1}, Landroid/app/Dialog;->getWindow()Landroid/view/Window;

    move-result-object p1

    const/4 v0, 0x5

    .line 14
    invoke-virtual {p1, v0}, Landroid/view/Window;->setSoftInputMode(I)V

    return-void
.end method

.method private a(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 2

    .line 1
    invoke-static {p1, p0, p2}, Lcom/jecelyin/editor/v2/preference/a;->a(Landroid/content/Context;Landroid/preference/Preference;Landroid/util/AttributeSet;)V

    .line 2
    new-instance v0, Landroidx/appcompat/widget/AppCompatEditText;

    invoke-direct {v0, p1, p2}, Landroidx/appcompat/widget/AppCompatEditText;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    iput-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    const p2, 0x1020003

    .line 3
    invoke-virtual {v0, p2}, Landroid/widget/EditText;->setId(I)V

    .line 4
    iget-object p2, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    const/4 v0, 0x1

    invoke-virtual {p2, v0}, Landroid/widget/EditText;->setEnabled(Z)V

    .line 5
    iget-object p2, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    sget v1, Lcom/jecelyin/editor/v2/n;->CustomDialogEditStyle:I

    invoke-virtual {p2, p1, v1}, Landroid/widget/EditText;->setTextAppearance(Landroid/content/Context;I)V

    new-array p2, v0, [I

    .line 6
    sget v0, Lcom/jecelyin/editor/v2/f;->customDialogEditBackground:I

    const/4 v1, 0x0

    aput v0, p2, v1

    invoke-virtual {p1, p2}, Landroid/content/Context;->obtainStyledAttributes([I)Landroid/content/res/TypedArray;

    move-result-object p2

    .line 7
    invoke-virtual {p2, v1}, Landroid/content/res/TypedArray;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object p2

    .line 8
    iget-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    invoke-virtual {v0, p2}, Landroid/widget/EditText;->setBackground(Landroid/graphics/drawable/Drawable;)V

    .line 9
    iget-object p2, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    sget v1, Lcom/jecelyin/editor/v2/h;->je_dp_30:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result v0

    invoke-virtual {p2, v0}, Landroid/widget/EditText;->setMinHeight(I)V

    .line 10
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object p2

    sget v0, Lcom/jecelyin/editor/v2/h;->je_dp_5:I

    invoke-virtual {p2, v0}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result p2

    .line 11
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object p1

    sget v0, Lcom/jecelyin/editor/v2/h;->je_dp_10:I

    invoke-virtual {p1, v0}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result p1

    .line 12
    iget-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    invoke-virtual {v0, p1, p2, p1, p2}, Landroid/widget/EditText;->setPadding(IIII)V

    return-void
.end method


# virtual methods
.method protected a(Lcom/jecelyin/common/widget/dialog/a$c;)V
    .locals 0

    return-void
.end method

.method public getDialog()Landroid/app/Dialog;
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a:Lcom/jecelyin/common/widget/dialog/a;

    return-object v0
.end method

.method public getEditText()Landroid/widget/EditText;
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    return-object v0
.end method

.method public onActivityDestroy()V
    .locals 1

    .line 1
    invoke-super {p0}, Landroid/preference/EditTextPreference;->onActivityDestroy()V

    .line 2
    iget-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a:Lcom/jecelyin/common/widget/dialog/a;

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/app/Dialog;->isShowing()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 3
    iget-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a:Lcom/jecelyin/common/widget/dialog/a;

    invoke-virtual {v0}, Landroid/app/Dialog;->dismiss()V

    :cond_0
    return-void
.end method

.method protected onAddEditTextToDialogView(Landroid/view/View;Landroid/widget/EditText;)V
    .locals 3
    .param p1    # Landroid/view/View;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Landroid/widget/EditText;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 1
    check-cast p1, Landroid/view/ViewGroup;

    new-instance v0, Landroid/widget/LinearLayout$LayoutParams;

    const/4 v1, -0x1

    const/4 v2, -0x2

    invoke-direct {v0, v1, v2}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V

    invoke-virtual {p1, p2, v0}, Landroid/view/ViewGroup;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    return-void
.end method

.method protected onBindDialogView(Landroid/view/View;)V
    .locals 2
    .param p1    # Landroid/view/View;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "MissingSuperCall"
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    .line 2
    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getText()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V

    .line 3
    invoke-virtual {v0}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->length()I

    move-result v1

    if-lez v1, :cond_0

    .line 4
    invoke-virtual {v0}, Landroid/widget/EditText;->length()I

    move-result v1

    invoke-virtual {v0, v1}, Landroid/widget/EditText;->setSelection(I)V

    .line 5
    :cond_0
    invoke-virtual {v0}, Landroid/widget/EditText;->getParent()Landroid/view/ViewParent;

    move-result-object v1

    if-eq v1, p1, :cond_2

    if-eqz v1, :cond_1

    .line 6
    check-cast v1, Landroid/view/ViewGroup;

    invoke-virtual {v1, v0}, Landroid/view/ViewGroup;->removeView(Landroid/view/View;)V

    .line 7
    :cond_1
    invoke-virtual {p0, p1, v0}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->onAddEditTextToDialogView(Landroid/view/View;Landroid/widget/EditText;)V

    :cond_2
    return-void
.end method

.method protected onDialogClosed(Z)V
    .locals 1

    if-eqz p1, :cond_0

    .line 1
    iget-object p1, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->b:Landroid/widget/EditText;

    invoke-virtual {p1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object p1

    invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object p1

    .line 2
    invoke-virtual {p0, p1}, Landroid/preference/EditTextPreference;->callChangeListener(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 3
    invoke-virtual {p0, p1}, Landroid/preference/EditTextPreference;->setText(Ljava/lang/String;)V

    :cond_0
    return-void
.end method

.method public onDismiss(Landroid/content/DialogInterface;)V
    .locals 0

    .line 1
    invoke-super {p0, p1}, Landroid/preference/EditTextPreference;->onDismiss(Landroid/content/DialogInterface;)V

    .line 2
    invoke-static {p0, p0}, Lcom/jecelyin/editor/v2/preference/a;->b(Landroid/preference/Preference;Landroid/preference/PreferenceManager$OnActivityDestroyListener;)V

    return-void
.end method

.method protected onRestoreInstanceState(Landroid/os/Parcelable;)V
    .locals 2

    if-eqz p1, :cond_2

    .line 1
    invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v0

    const-class v1, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;

    invoke-virtual {v0, v1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    goto :goto_0

    .line 2
    :cond_0
    check-cast p1, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;

    .line 3
    invoke-virtual {p1}, Landroid/preference/Preference$BaseSavedState;->getSuperState()Landroid/os/Parcelable;

    move-result-object v0

    invoke-super {p0, v0}, Landroid/preference/EditTextPreference;->onRestoreInstanceState(Landroid/os/Parcelable;)V

    .line 4
    iget-boolean v0, p1, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;->a:Z

    if-eqz v0, :cond_1

    .line 5
    iget-object p1, p1, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;->b:Landroid/os/Bundle;

    invoke-virtual {p0, p1}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->showDialog(Landroid/os/Bundle;)V

    :cond_1
    return-void

    .line 6
    :cond_2
    :goto_0
    invoke-super {p0, p1}, Landroid/preference/EditTextPreference;->onRestoreInstanceState(Landroid/os/Parcelable;)V

    return-void
.end method

.method protected onSaveInstanceState()Landroid/os/Parcelable;
    .locals 3

    .line 1
    invoke-super {p0}, Landroid/preference/EditTextPreference;->onSaveInstanceState()Landroid/os/Parcelable;

    move-result-object v0

    .line 2
    invoke-virtual {p0}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->getDialog()Landroid/app/Dialog;

    move-result-object v1

    if-eqz v1, :cond_1

    .line 3
    invoke-virtual {v1}, Landroid/app/Dialog;->isShowing()Z

    move-result v2

    if-nez v2, :cond_0

    goto :goto_0

    .line 4
    :cond_0
    new-instance v2, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;

    invoke-direct {v2, v0}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;-><init>(Landroid/os/Parcelable;)V

    const/4 v0, 0x1

    .line 5
    iput-boolean v0, v2, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;->a:Z

    .line 6
    invoke-virtual {v1}, Landroid/app/Dialog;->onSaveInstanceState()Landroid/os/Bundle;

    move-result-object v0

    iput-object v0, v2, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$d;->b:Landroid/os/Bundle;

    return-object v2

    :cond_1
    :goto_0
    return-object v0
.end method

.method protected showDialog(Landroid/os/Bundle;)V
    .locals 4

    .line 1
    new-instance v0, Lcom/jecelyin/common/widget/dialog/a$c;

    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lcom/jecelyin/common/widget/dialog/a$c;-><init>(Landroid/content/Context;)V

    .line 2
    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getDialogTitle()Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/jecelyin/common/widget/dialog/a$c;->e(Ljava/lang/CharSequence;)Lcom/jecelyin/common/widget/dialog/a$c;

    .line 3
    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getPositiveButtonText()Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/jecelyin/common/widget/dialog/a$c;->d(Ljava/lang/CharSequence;)Lcom/jecelyin/common/widget/dialog/a$c;

    .line 4
    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getNegativeButtonText()Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/jecelyin/common/widget/dialog/a$c;->b(Ljava/lang/CharSequence;)Lcom/jecelyin/common/widget/dialog/a$c;

    new-instance v1, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$c;

    invoke-direct {v1, p0}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$c;-><init>(Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;)V

    .line 5
    invoke-virtual {v0, v1}, Lcom/jecelyin/common/widget/dialog/a$c;->c(Landroid/content/DialogInterface$OnClickListener;)Lcom/jecelyin/common/widget/dialog/a$c;

    new-instance v1, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$b;

    invoke-direct {v1, p0}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$b;-><init>(Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;)V

    .line 6
    invoke-virtual {v0, v1}, Lcom/jecelyin/common/widget/dialog/a$c;->b(Landroid/content/DialogInterface$OnClickListener;)Lcom/jecelyin/common/widget/dialog/a$c;

    new-instance v1, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$a;

    invoke-direct {v1, p0}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference$a;-><init>(Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;)V

    .line 7
    invoke-virtual {v0, v1}, Lcom/jecelyin/common/widget/dialog/a$c;->a(Landroid/content/DialogInterface$OnClickListener;)Lcom/jecelyin/common/widget/dialog/a$c;

    .line 8
    invoke-virtual {v0}, Lcom/jecelyin/common/widget/dialog/a$c;->a()Lcom/jecelyin/common/widget/dialog/a;

    move-result-object v1

    .line 9
    invoke-virtual {v1, p0}, Landroid/app/Dialog;->setOnDismissListener(Landroid/content/DialogInterface$OnDismissListener;)V

    .line 10
    invoke-virtual {p0, v0}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a(Lcom/jecelyin/common/widget/dialog/a$c;)V

    .line 11
    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-static {v1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v1

    sget v2, Lcom/jecelyin/editor/v2/k;->je_custom_preference_stub_input:I

    const/4 v3, 0x0

    invoke-virtual {v1, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v1

    .line 12
    invoke-virtual {p0, v1}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->onBindDialogView(Landroid/view/View;)V

    const v2, 0x102000b

    .line 13
    invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/TextView;

    .line 14
    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getDialogMessage()Ljava/lang/CharSequence;

    move-result-object v3

    if-eqz v3, :cond_0

    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getDialogMessage()Ljava/lang/CharSequence;

    move-result-object v3

    invoke-interface {v3}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/String;->length()I

    move-result v3

    if-lez v3, :cond_0

    const/4 v3, 0x0

    .line 15
    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setVisibility(I)V

    .line 16
    invoke-virtual {p0}, Landroid/preference/EditTextPreference;->getDialogMessage()Ljava/lang/CharSequence;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0

    :cond_0
    const/16 v3, 0x8

    .line 17
    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setVisibility(I)V

    .line 18
    :goto_0
    invoke-virtual {v0, v1}, Lcom/jecelyin/common/widget/dialog/a$c;->a(Landroid/view/View;)Lcom/jecelyin/common/widget/dialog/a$c;

    .line 19
    invoke-static {p0, p0}, Lcom/jecelyin/editor/v2/preference/a;->a(Landroid/preference/Preference;Landroid/preference/PreferenceManager$OnActivityDestroyListener;)V

    .line 20
    invoke-virtual {v0}, Lcom/jecelyin/common/widget/dialog/a$c;->a()Lcom/jecelyin/common/widget/dialog/a;

    move-result-object v0

    iput-object v0, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a:Lcom/jecelyin/common/widget/dialog/a;

    if-eqz p1, :cond_1

    .line 21
    invoke-virtual {v0, p1}, Landroid/app/Dialog;->onRestoreInstanceState(Landroid/os/Bundle;)V

    .line 22
    :cond_1
    iget-object p1, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a:Lcom/jecelyin/common/widget/dialog/a;

    invoke-direct {p0, p1}, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a(Landroid/app/Dialog;)V

    .line 23
    iget-object p1, p0, Lcom/jecelyin/editor/v2/preference/CustomEditTextPreference;->a:Lcom/jecelyin/common/widget/dialog/a;

    invoke-virtual {p1}, Landroid/app/Dialog;->show()V

    return-void
.end method
